function handles = addCells(handles)
% addCells
% 
% Editing:
% gs may 2005
% ----------------------------------------------------

% prompt user for new name
newName = inputdlg('Name of new cell to add:');
newName = newName{1};
% newName = newName(1);
if isempty(newName)
    return
end

% determine which group is also selected
groupVal = get(handles.groupList, 'Value');

% determine how many cells there are already, add this one to end, make current
cellIDs = get(handles.cellList, 'String');
cellVal = size(cellIDs, 1) + 1;

% newName
% size(newName)
% class(newName)
% return

cellIDs{cellVal} = newName;
set(handles.cellList, 'String', cellIDs);
set(handles.cellList, 'Value', cellVal);

% rename as needed in the handles structure
listsAndExpts = handles.analysis.mapAverager.cellLists.currentFile.listsAndExpts;
newList = listsAndExpts(groupVal, 2);
% celldisp(newList)
newList{1}{cellVal} = newName;
% celldisp(newList)
listsAndExpts(groupVal, 2) = newList;
% celldisp(listsAndExpts)
handles.analysis.mapAverager.cellLists.currentFile.listsAndExpts = listsAndExpts;

handles = saveListFile(handles);
